/**
	* Copyright (c) minuteproject, minuteproject@gmail.com
	* All rights reserved.
	* 
	* Licensed under the Apache License, Version 2.0 (the "License")
	* you may not use this file except in compliance with the License.
	* You may obtain a copy of the License at
	* 
	* http://www.apache.org/licenses/LICENSE-2.0
	* 
	* Unless required by applicable law or agreed to in writing, software
	* distributed under the License is distributed on an "AS IS" BASIS,
	* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
	* See the License for the specific language governing permissions and
	* limitations under the License.
	* 
	* More information on minuteproject:
	* twitter @minuteproject
	* wiki http://minuteproject.wikispaces.com 
	* blog http://minuteproject.blogspot.net
	* 
*/
/**
	* template reference : 
	* - name : OpenxavaDomainObjectUML
	* - file name : DomainObjectUMLJPAAnnotationOXAnnotationV4.vm
*/
package sistema_oficial.sistema_oficial.domain.sistemaoficial;

//MP-MANAGED-ADDED-AREA-BEGINNING @import@
//MP-MANAGED-ADDED-AREA-ENDING @import@
import java.sql.*;
import java.util.Date;
import java.util.List;
import java.util.ArrayList;
import java.util.Set;
import java.util.HashSet;

import javax.persistence.*;
import org.openxava.annotations.*;

import calculators.*;

import sistema_oficial.sistema_oficial.domain.sistemaoficial.DetalleCompra;
import sistema_oficial.sistema_oficial.domain.sistemaoficial.OrdenEntrada;
import sistema_oficial.sistema_oficial.domain.sistemaoficial.PagoFactura;
import sistema_oficial.sistema_oficial.domain.sistemaoficial.Proveedor;
import sistema_oficial.sistema_oficial.domain.sistemaoficial.TipoFacturaCompra;
import sistema_oficial.sistema_oficial.domain.sistemaoficial.TipoCompra;
import sistema_oficial.sistema_oficial.domain.sistemaoficial.FormaPagoCompra;
import sistema_oficial.sistema_oficial.domain.sistemaoficial.SeccionCompra;

/**
 *
 * <p>Title: FacturaCompra</p>
 *
 * <p>Description: Domain Object describing a FacturaCompra entity</p>
 *
 */
@Entity (name="FacturaCompra")
@Table (name="factura_compra")
@Views({
//MP-MANAGED-UPDATABLE-BEGINNING-DISABLE @view-base-factura_compra@
	@View(
		name="base",
		members=
        "" 	
        + "identificador  ; "
        + "fechaRegistro  ; "
        + "fechaEmision  ; "
        + "serie  ; "
        + "numero  ; "
        + "proveedorCodigo  ; "
        + "tipoFacturaCompraIdentificador  ; "
        + "tipoCompraIdentificador  ; "
        + "formaPagoCompraIdentificador  ; "
        + "total  ; "
        + "base  ; "
        + "iva  ; "
        + "pagoCompleto  ; "
        + "verificado  ; "
        + "seccionCompraCodigo  ; "
		),
//MP-MANAGED-UPDATABLE-ENDING
	@View(
		name="Create", 
		extendsView="base"
	),
	@View(
		name="Update", 
		extendsView="base",
        members=
          "" 	
	    + "detalleCompra { detalleCompraFacturaCompraViaFacturaCompraIdentificador };" 
	    + "ordenEntrada { ordenEntradaFacturaCompraViaFacturaCompraIdentificador };" 
	    + "pagoFactura { pagoFacturaFacturaCompraViaFacturaCompraIdentificador };" 
	),
	@View(extendsView="base",
        members=
          "" 	
	    ),
    @View(name="facturaCompraDEFAULT_VIEW", 
	   members=
          " identificador ;" 	
        + "fechaRegistro  ; "
        + "fechaEmision  ; "
        + "serie  ; "
        + "numero  ; "
        + "total  ; "
        + "base  ; "
        + "iva  ; "
        + "pagoCompleto  ; "
        + "verificado  ; "
	),
//MP-MANAGED-UPDATABLE-BEGINNING-DISABLE @view-reference-factura_compra@
    @View(name="reference", 
       extendsView="facturaCompraDEFAULT_VIEW"
//MP-MANAGED-UPDATABLE-ENDING
    )
})

@Tabs({
@Tab(
properties=
     " fechaRegistro "
    +",  fechaEmision "
    +",  serie "
    +",  numero "
    +",  total "
    +",  base "
    +",  iva "
    +",  pagoCompleto "
    +",  verificado "
)
,
@Tab(
name = "FacturaCompraTab",
properties=
     " fechaRegistro "
    +",  fechaEmision "
    +",  serie "
    +",  numero "
    +",  total "
    +",  base "
    +",  iva "
    +",  pagoCompleto "
    +",  verificado "
)
,
@Tab(
name = "FacturaCompraTabWithRef",
properties=
     " fechaRegistro "
    +",  fechaEmision "
    +",  serie "
    +",  numero "
    +",  total "
    +",  base "
    +",  iva "
    +",  pagoCompleto "
    +",  verificado "
)
})
//MP-MANAGED-ADDED-AREA-BEGINNING @class-annotation@
//MP-MANAGED-ADDED-AREA-ENDING @class-annotation@
public class FacturaCompra {

    @Hidden @Id @Column(name="identificador" )
    private Integer identificador; 

//MP-MANAGED-ADDED-AREA-BEGINNING @fecha_registro-field-annotation@
//MP-MANAGED-ADDED-AREA-ENDING @fecha_registro-field-annotation@

//MP-MANAGED-UPDATABLE-BEGINNING-DISABLE @ATTRIBUTE-fecha_registro@
    @Column(name="fecha_registro",   nullable=false,  unique=false)
    @Required
    private Date fechaRegistro;	
//MP-MANAGED-UPDATABLE-ENDING

//MP-MANAGED-ADDED-AREA-BEGINNING @fecha_emision-field-annotation@
//MP-MANAGED-ADDED-AREA-ENDING @fecha_emision-field-annotation@

//MP-MANAGED-UPDATABLE-BEGINNING-DISABLE @ATTRIBUTE-fecha_emision@
    @Column(name="fecha_emision",   nullable=false,  unique=false)
    @Required
    private Date fechaEmision;	
//MP-MANAGED-UPDATABLE-ENDING

//MP-MANAGED-ADDED-AREA-BEGINNING @serie-field-annotation@
//MP-MANAGED-ADDED-AREA-ENDING @serie-field-annotation@

//MP-MANAGED-UPDATABLE-BEGINNING-DISABLE @ATTRIBUTE-serie@
    @Column(name="serie",  length=25,  nullable=true,  unique=false)
    private String serie;	
//MP-MANAGED-UPDATABLE-ENDING

//MP-MANAGED-ADDED-AREA-BEGINNING @numero-field-annotation@
//MP-MANAGED-ADDED-AREA-ENDING @numero-field-annotation@

//MP-MANAGED-UPDATABLE-BEGINNING-DISABLE @ATTRIBUTE-numero@
    @Column(name="numero",  length=100, nullable=false,  unique=false)
    @Required
    private String numero;	
//MP-MANAGED-UPDATABLE-ENDING

//MP-MANAGED-ADDED-AREA-BEGINNING @total-field-annotation@
//MP-MANAGED-ADDED-AREA-ENDING @total-field-annotation@

//MP-MANAGED-UPDATABLE-BEGINNING-DISABLE @ATTRIBUTE-total@
    @Column(name="total",    nullable=true,  unique=false)
    private java.math.BigDecimal total;	
//MP-MANAGED-UPDATABLE-ENDING

//MP-MANAGED-ADDED-AREA-BEGINNING @base-field-annotation@
//MP-MANAGED-ADDED-AREA-ENDING @base-field-annotation@

//MP-MANAGED-UPDATABLE-BEGINNING-DISABLE @ATTRIBUTE-base@
    @Column(name="base",    nullable=true,  unique=false)
    private java.math.BigDecimal base;	
//MP-MANAGED-UPDATABLE-ENDING

//MP-MANAGED-ADDED-AREA-BEGINNING @iva-field-annotation@
//MP-MANAGED-ADDED-AREA-ENDING @iva-field-annotation@

//MP-MANAGED-UPDATABLE-BEGINNING-DISABLE @ATTRIBUTE-iva@
    @Column(name="iva",    nullable=true,  unique=false)
    private java.math.BigDecimal iva;	
//MP-MANAGED-UPDATABLE-ENDING

//MP-MANAGED-ADDED-AREA-BEGINNING @pago_completo-field-annotation@
//MP-MANAGED-ADDED-AREA-ENDING @pago_completo-field-annotation@

//MP-MANAGED-UPDATABLE-BEGINNING-DISABLE @ATTRIBUTE-pago_completo@
    @Column(name="pago_completo",   nullable=false,  unique=false)
    @Required
    private Boolean pagoCompleto;	
//MP-MANAGED-UPDATABLE-ENDING

//MP-MANAGED-ADDED-AREA-BEGINNING @verificado-field-annotation@
//MP-MANAGED-ADDED-AREA-ENDING @verificado-field-annotation@

//MP-MANAGED-UPDATABLE-BEGINNING-DISABLE @ATTRIBUTE-verificado@
    @Column(name="verificado",   nullable=false,  unique=false)
    @Required
    private Boolean verificado;	
//MP-MANAGED-UPDATABLE-ENDING


//MP-MANAGED-UPDATABLE-BEGINNING-DISABLE @parent-Proveedor-factura_compra@
    @ManyToOne (fetch=FetchType.LAZY ,optional=false) //remove optional=false to aggragate but leads to a side effect when going directly to the entity: required check is not performed=> if no set DB check constraint is raised...
    @JoinColumn(name="proveedor_codigo", nullable=false,  unique=false  )
    @ReferenceView ("reference") 
    private Proveedor proveedorCodigo; 
    
//MP-MANAGED-UPDATABLE-ENDING
//MP-MANAGED-UPDATABLE-BEGINNING-DISABLE @parent-TipoFacturaCompra-factura_compra@
    @ManyToOne (fetch=FetchType.LAZY ,optional=false) //remove optional=false to aggragate but leads to a side effect when going directly to the entity: required check is not performed=> if no set DB check constraint is raised...
    @JoinColumn(name="tipo_factura_compra_identificador", nullable=false,  unique=false  )
    @ReferenceView ("reference") 
    @DefaultValueCalculator(TipoFacturaCompraCalculator.class)
    private TipoFacturaCompra tipoFacturaCompraIdentificador; 
    
//MP-MANAGED-UPDATABLE-ENDING
//MP-MANAGED-UPDATABLE-BEGINNING-DISABLE @parent-TipoCompra-factura_compra@
    @ManyToOne (fetch=FetchType.LAZY ,optional=false) //remove optional=false to aggragate but leads to a side effect when going directly to the entity: required check is not performed=> if no set DB check constraint is raised...
    @JoinColumn(name="tipo_compra_identificador", nullable=false,  unique=false  )
    @ReferenceView ("reference") 
    @DefaultValueCalculator(TipoCompraCalculator.class)
    private TipoCompra tipoCompraIdentificador; 
    
//MP-MANAGED-UPDATABLE-ENDING
//MP-MANAGED-UPDATABLE-BEGINNING-DISABLE @parent-FormaPagoCompra-factura_compra@
    @ManyToOne (fetch=FetchType.LAZY ,optional=false) //remove optional=false to aggragate but leads to a side effect when going directly to the entity: required check is not performed=> if no set DB check constraint is raised...
    @JoinColumn(name="forma_pago_compra_identificador", nullable=false,  unique=false  )
    @ReferenceView ("reference") 
    @DefaultValueCalculator(FormaPagoCompraCalculator.class)
    private FormaPagoCompra formaPagoCompraIdentificador; 
    
//MP-MANAGED-UPDATABLE-ENDING
//MP-MANAGED-UPDATABLE-BEGINNING-DISABLE @parent-SeccionCompra-factura_compra@
    @ManyToOne (fetch=FetchType.LAZY ,optional=false) //remove optional=false to aggragate but leads to a side effect when going directly to the entity: required check is not performed=> if no set DB check constraint is raised...
    @JoinColumn(name="seccion_compra_codigo", nullable=false,  unique=false  )
    @ReferenceView ("reference") 
    private SeccionCompra seccionCompraCodigo; 
    
//MP-MANAGED-UPDATABLE-ENDING
//children
//MP-MANAGED-UPDATABLE-BEGINNING-DISABLE @child-detalleCompraFacturaCompraViaFacturaCompraIdentificador-factura_compra@
    @OneToMany (targetEntity=sistema_oficial.sistema_oficial.domain.sistemaoficial.DetalleCompra.class, fetch=FetchType.LAZY, mappedBy="facturaCompraIdentificador", cascade=CascadeType.REMOVE)//, cascade=CascadeType.ALL)
    private Set <DetalleCompra> detalleCompraFacturaCompraViaFacturaCompraIdentificador = new HashSet<DetalleCompra>(); 
   
//MP-MANAGED-UPDATABLE-ENDING
//MP-MANAGED-UPDATABLE-BEGINNING-DISABLE @child-ordenEntradaFacturaCompraViaFacturaCompraIdentificador-factura_compra@
    @OneToMany (targetEntity=sistema_oficial.sistema_oficial.domain.sistemaoficial.OrdenEntrada.class, fetch=FetchType.LAZY, mappedBy="facturaCompraIdentificador", cascade=CascadeType.REMOVE)//, cascade=CascadeType.ALL)
    private Set <OrdenEntrada> ordenEntradaFacturaCompraViaFacturaCompraIdentificador = new HashSet<OrdenEntrada>(); 
   
//MP-MANAGED-UPDATABLE-ENDING
//MP-MANAGED-UPDATABLE-BEGINNING-DISABLE @child-pagoFacturaFacturaCompraViaFacturaCompraIdentificador-factura_compra@
    @OneToMany (targetEntity=sistema_oficial.sistema_oficial.domain.sistemaoficial.PagoFactura.class, fetch=FetchType.LAZY, mappedBy="facturaCompraIdentificador", cascade=CascadeType.REMOVE)//, cascade=CascadeType.ALL)
    private Set <PagoFactura> pagoFacturaFacturaCompraViaFacturaCompraIdentificador = new HashSet<PagoFactura>(); 
   
//MP-MANAGED-UPDATABLE-ENDING
//m2m
    /**
    * Default constructor
    */
    public FacturaCompra() {
    }


    public Integer getIdentificador() {
        return identificador;
    }
	
    public void setIdentificador (Integer identificador) {
        this.identificador =  identificador;
    }
    

//MP-MANAGED-UPDATABLE-BEGINNING-DISABLE @GETTER-SETTER-fecha_registro@
    public Date getFechaRegistro() {
        return fechaRegistro;
    }
	
    public void setFechaRegistro (Date fechaRegistro) {
        this.fechaRegistro =  fechaRegistro;
    } 
//MP-MANAGED-UPDATABLE-ENDING

//MP-MANAGED-UPDATABLE-BEGINNING-DISABLE @GETTER-SETTER-fecha_emision@
    public Date getFechaEmision() {
        return fechaEmision;
    }
	
    public void setFechaEmision (Date fechaEmision) {
        this.fechaEmision =  fechaEmision;
    } 
//MP-MANAGED-UPDATABLE-ENDING

//MP-MANAGED-UPDATABLE-BEGINNING-DISABLE @GETTER-SETTER-serie@
    public String getSerie() {
        return serie;
    }
	
    public void setSerie (String serie) {
        this.serie =  serie;
    } 
//MP-MANAGED-UPDATABLE-ENDING

//MP-MANAGED-UPDATABLE-BEGINNING-DISABLE @GETTER-SETTER-numero@
    public String getNumero() {
        return numero;
    }
	
    public void setNumero (String numero) {
        this.numero =  numero;
    } 
//MP-MANAGED-UPDATABLE-ENDING

//MP-MANAGED-UPDATABLE-BEGINNING-DISABLE @GETTER-SETTER-total@
    public java.math.BigDecimal getTotal() {
        return total;
    }
	
    public void setTotal (java.math.BigDecimal total) {
        this.total =  total;
    } 
//MP-MANAGED-UPDATABLE-ENDING

//MP-MANAGED-UPDATABLE-BEGINNING-DISABLE @GETTER-SETTER-base@
    public java.math.BigDecimal getBase() {
        return base;
    }
	
    public void setBase (java.math.BigDecimal base) {
        this.base =  base;
    } 
//MP-MANAGED-UPDATABLE-ENDING

//MP-MANAGED-UPDATABLE-BEGINNING-DISABLE @GETTER-SETTER-iva@
    public java.math.BigDecimal getIva() {
        return iva;
    }
	
    public void setIva (java.math.BigDecimal iva) {
        this.iva =  iva;
    } 
//MP-MANAGED-UPDATABLE-ENDING

//MP-MANAGED-UPDATABLE-BEGINNING-DISABLE @GETTER-SETTER-pago_completo@
    public Boolean getPagoCompleto() {
        return pagoCompleto;
    }
	
    public void setPagoCompleto (Boolean pagoCompleto) {
        this.pagoCompleto =  pagoCompleto;
    } 
//MP-MANAGED-UPDATABLE-ENDING

//MP-MANAGED-UPDATABLE-BEGINNING-DISABLE @GETTER-SETTER-verificado@
    public Boolean getVerificado() {
        return verificado;
    }
	
    public void setVerificado (Boolean verificado) {
        this.verificado =  verificado;
    } 
//MP-MANAGED-UPDATABLE-ENDING


    public Proveedor getProveedorCodigo () {  //
    	return proveedorCodigo;
    }
	
    public void setProveedorCodigo (Proveedor proveedorCodigo) {
    	this.proveedorCodigo = proveedorCodigo;//this.proveedorCodigo = proveedor;
    }
    public TipoFacturaCompra getTipoFacturaCompraIdentificador () {  //
    	return tipoFacturaCompraIdentificador;
    }
	
    public void setTipoFacturaCompraIdentificador (TipoFacturaCompra tipoFacturaCompraIdentificador) {
    	this.tipoFacturaCompraIdentificador = tipoFacturaCompraIdentificador;//this.tipoFacturaCompraIdentificador = tipoFacturaCompra;
    }
    public TipoCompra getTipoCompraIdentificador () {  //
    	return tipoCompraIdentificador;
    }
	
    public void setTipoCompraIdentificador (TipoCompra tipoCompraIdentificador) {
    	this.tipoCompraIdentificador = tipoCompraIdentificador;//this.tipoCompraIdentificador = tipoCompra;
    }
    public FormaPagoCompra getFormaPagoCompraIdentificador () {  //
    	return formaPagoCompraIdentificador;
    }
	
    public void setFormaPagoCompraIdentificador (FormaPagoCompra formaPagoCompraIdentificador) {
    	this.formaPagoCompraIdentificador = formaPagoCompraIdentificador;//this.formaPagoCompraIdentificador = formaPagoCompra;
    }
    public SeccionCompra getSeccionCompraCodigo () {  //
    	return seccionCompraCodigo;
    }
	
    public void setSeccionCompraCodigo (SeccionCompra seccionCompraCodigo) {
    	this.seccionCompraCodigo = seccionCompraCodigo;//this.seccionCompraCodigo = seccionCompra;
    }

    public Set<DetalleCompra> getDetalleCompraFacturaCompraViaFacturaCompraIdentificador() {
        if (detalleCompraFacturaCompraViaFacturaCompraIdentificador == null){
            detalleCompraFacturaCompraViaFacturaCompraIdentificador = new HashSet<DetalleCompra>();
        }
        return detalleCompraFacturaCompraViaFacturaCompraIdentificador;
    }

    public void setDetalleCompraFacturaCompraViaFacturaCompraIdentificador (Set<DetalleCompra> detalleCompraFacturaCompraViaFacturaCompraIdentificador) {
        this.detalleCompraFacturaCompraViaFacturaCompraIdentificador = detalleCompraFacturaCompraViaFacturaCompraIdentificador;
    }	
    
    public void addDetalleCompraFacturaCompraViaFacturaCompraIdentificador (DetalleCompra detalleCompra) {
    	    getDetalleCompraFacturaCompraViaFacturaCompraIdentificador().add(detalleCompra);
    }
    
    public Set<OrdenEntrada> getOrdenEntradaFacturaCompraViaFacturaCompraIdentificador() {
        if (ordenEntradaFacturaCompraViaFacturaCompraIdentificador == null){
            ordenEntradaFacturaCompraViaFacturaCompraIdentificador = new HashSet<OrdenEntrada>();
        }
        return ordenEntradaFacturaCompraViaFacturaCompraIdentificador;
    }

    public void setOrdenEntradaFacturaCompraViaFacturaCompraIdentificador (Set<OrdenEntrada> ordenEntradaFacturaCompraViaFacturaCompraIdentificador) {
        this.ordenEntradaFacturaCompraViaFacturaCompraIdentificador = ordenEntradaFacturaCompraViaFacturaCompraIdentificador;
    }	
    
    public void addOrdenEntradaFacturaCompraViaFacturaCompraIdentificador (OrdenEntrada ordenEntrada) {
    	    getOrdenEntradaFacturaCompraViaFacturaCompraIdentificador().add(ordenEntrada);
    }
    
    public Set<PagoFactura> getPagoFacturaFacturaCompraViaFacturaCompraIdentificador() {
        if (pagoFacturaFacturaCompraViaFacturaCompraIdentificador == null){
            pagoFacturaFacturaCompraViaFacturaCompraIdentificador = new HashSet<PagoFactura>();
        }
        return pagoFacturaFacturaCompraViaFacturaCompraIdentificador;
    }

    public void setPagoFacturaFacturaCompraViaFacturaCompraIdentificador (Set<PagoFactura> pagoFacturaFacturaCompraViaFacturaCompraIdentificador) {
        this.pagoFacturaFacturaCompraViaFacturaCompraIdentificador = pagoFacturaFacturaCompraViaFacturaCompraIdentificador;
    }	
    
    public void addPagoFacturaFacturaCompraViaFacturaCompraIdentificador (PagoFactura pagoFactura) {
    	    getPagoFacturaFacturaCompraViaFacturaCompraIdentificador().add(pagoFactura);
    }
    



//MP-MANAGED-ADDED-AREA-BEGINNING @implementation@
//MP-MANAGED-ADDED-AREA-ENDING @implementation@

}
